package com.xbongbong.paas.pojo.workflow.explains.dto;

import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.field.LinkInfoPojo;
import com.xbongbong.pro.enums.workflow.WorkflowValueTypeEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author 吴峰
 * @date 2021/05/28 10:11
 */
@Getter
@Setter
@ToString
public class WorkflowInsertNodeOperatorFieldDTO extends BaseDTO {
    private static final long serialVersionUID = 3535260839095201379L;

    @NotNull(message = "{dto.msg.workflowId.NotNull}")
    private Long workflowId;

    @NotNull(message = "{dto.msg.workflowNodeId.NotNull}")
    private Long workflowNodeId;
    /**
     * 条件值
     */
    @NotNull(message = "{dto.msg.formId.NotNull}")
    private Long formId;

    @NotNull(message = "{dto.msg.saasMark.NotNull}")
    private Integer saasMark;

    @NotNull(message = "{dto.msg.businessType.NotNull}")
    private Integer businessType;

    @NotEmpty(message = "{dto.msg.WorkflowInsertNodeOperatorFieldDTO.nodeId.NotNull}")
    private String nodeId;

    @NotEmpty(message = "{dto.msg.WorkflowInsertNodeOperatorFieldDTO.prevId.NotNull}")
    private String prevId;
    /**
     * 更新对象节点id，只有更新节点传
     */
    private Long updateNodeId;

    private Integer fieldType;

    /**
     * 节点类型
     * @see com.xbongbong.workflow.enums.WorkflowNodeTypeEnum
     */
    private Integer type;

    /**
     * 数据源
     * 1:新增一条；2：基于多条记录逐条新增记录
     */
    private Integer chooseDataSource;
    /**
     * 如果chooseDataSource为2或者更新数据节点，则需要起始节点和所选择的获取数据节点id
     */
    private List<Long> targetNodeId;
    /**
     * 关联字段
     */
    private String linkAttr;

    /**
     * @see WorkflowValueTypeEnum
     */
    private Integer valueType;


    private LinkInfoPojo linkInfo;

    /**
     * 如果是系统关联字段，字段中这个属性会关联业务类型，需要用到这个属性
     */
    private Integer linkedType;

    public WorkflowInsertNodeOperatorFieldDTO() {
    }

    public WorkflowInsertNodeOperatorFieldDTO(@NotNull(message = "{dto.msg.workflowId.NotNull}") Long workflowId, @NotNull(message = "{dto.msg.workflowNodeId.NotNull}") Long workflowNodeId,
                                              @NotNull(message = "{dto.msg.formId.NotNull}") Long formId, @NotNull(message = "{dto.msg.saasMark.NotNull}") Integer saasMark,
                                              @NotNull(message = "{dto.msg.businessType.NotNull}") Integer businessType, @NotEmpty(message = "{dto.msg.WorkflowInsertNodeOperatorFieldDTO.nodeId.NotNull}") String nodeId,
                                              @NotEmpty(message = "{dto.msg.WorkflowInsertNodeOperatorFieldDTO.prevId.NotNull}") String prevId, Integer fieldType, String linkAttr, Integer valueType,
                                              LinkInfoPojo linkInfo, Integer linkedType) {
        this.workflowId = workflowId;
        this.workflowNodeId = workflowNodeId;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.nodeId = nodeId;
        this.prevId = prevId;
        this.fieldType = fieldType;
        this.linkAttr = linkAttr;
        this.valueType = valueType;
        this.linkInfo = linkInfo;
        this.linkedType = linkedType;
    }
}
